package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicAllocatInwhItemDAO;
import com.cssy.xxkj.logic.entity.LogicAllocatInwhItemDO;
import com.plat.exception.SyBaseException;

/**
 * 数据访问对象实现类
 * @since 2014-09-27
 */
public class LogicAllocatInwhItemDAOImpl extends SqlMapClientDaoSupport implements LogicAllocatInwhItemDAO {

    /**
     * 插入数据
     * @param logicAllocatInwhItemDO
     * @return 插入数据的主键
     */
    public String insertLogicAllocatInwhItemDO(LogicAllocatInwhItemDO logicAllocatInwhItemDO) {
        Object id = getSqlMapClientTemplate().insert("LogicAllocatInwhItem.insert", logicAllocatInwhItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicAllocatInwhItemDO
     * @return 查出的记录数
     */
    public Integer countLogicAllocatInwhItemDOByExample(LogicAllocatInwhItemDO logicAllocatInwhItemDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatInwhItem.countByDOExample", logicAllocatInwhItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicAllocatInwhItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicAllocatInwhItemDO(LogicAllocatInwhItemDO logicAllocatInwhItemDO) {
        int result = getSqlMapClientTemplate().update("LogicAllocatInwhItem.update", logicAllocatInwhItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicAllocatInwhItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicAllocatInwhItemDO> findListByExample(LogicAllocatInwhItemDO logicAllocatInwhItemDO) {
        List<LogicAllocatInwhItemDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatInwhItem.findListByDO", logicAllocatInwhItemDO);
        return list;
    }
    
    @SuppressWarnings("unchecked")
    public List<LogicAllocatInwhItemDO> findListByMap(Map<String, Object> paramMap) 
    		throws SyBaseException{
        List<LogicAllocatInwhItemDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatInwhItem_ex.findListByMap", paramMap);
        return list;
    }

    /**
     * 根据主键获取logicAllocatInwhItemDO
     * @param id
     * @return logicAllocatInwhItemDO
     */
    public LogicAllocatInwhItemDO findLogicAllocatInwhItemDOByPrimaryKey(String id) {
        LogicAllocatInwhItemDO logicAllocatInwhItemDO = (LogicAllocatInwhItemDO) getSqlMapClientTemplate().queryForObject("LogicAllocatInwhItem.findByPrimaryKey", id);
        return logicAllocatInwhItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicAllocatInwhItemDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicAllocatInwhItem.deleteByPrimaryKey", id);
        return rows;
    }

}